JBoss Community Archive (Read Only)

Portlet Bridge 3.1

Getting Started

Installing Portlet Bridge

Prerequisites

There are no specific requirements to use Portlet Bridge in a JSF portlet, but it does need to be a JSF2 portlet for this version of the Portlet Bridge to function as expected.

Maven

There are now a few different ways to include Portlet Bridge into your application.

Artifact dependencies

The following dependencies are required in your pom.xml for a JSF2 portlet:

Portlet Bridge Maven Artifacts for JSF2
<dependency>
    <groupId>org.jboss.portletbridge</groupId>
    <artifactId>portletbridge-api</artifactId>
    <version>3.1.2.Final</version>
</dependency>
<dependency>
    <groupId>org.jboss.portletbridge</groupId>
    <artifactId>portletbridge-impl</artifactId>
    <version>3.1.2.Final</version>
    <scope>runtime</scope>
</dependency>

If your portlet uses RichFaces 4, then you will also need the following dependency:

Portlet Bridge Maven Artifacts for JSF2
<dependency>
    <groupId>org.jboss.portletbridge</groupId>
    <artifactId>portletbridge-extension-richfaces</artifactId>
    <version>3.1.2.Final</version>
    <scope>runtime</scope>
</dependency>

Depchain

Using the new Portlet Bridge depchain poms it's possible to reduce what needs to be added to your pom.xml to a single dependency.

For a JSF2 portlet add:

<dependency>
    <groupId>org.jboss.portletbridge</groupId>
    <artifactId>jsf2-depchain</artifactId>
    <version>3.1.2.Final</version>
    <type>pom</type>
</dependency>

For a RichFaces 4 portlet add:

<dependency>
    <groupId>org.jboss.portletbridge</groupId>
    <artifactId>richfaces4-depchain</artifactId>
    <version>3.1.2.Final</version>
    <type>pom</type>
</dependency>

Deploying to GateIn

When deploying to GateIn, the Portlet Bridge is automatically included for JSF2 portlets.

If you use the Portlet Bridge API in your code you still need to add it to your pom.xml with a provided scope. To do this the following dependency is required in your pom.xml:

<dependency>
    <groupId>org.jboss.portletbridge</groupId>
    <artifactId>portletbridge-api</artifactId>
    <version>3.1.2.Final</version>
    <scope>provided</scope>
</dependency>

If your portlet uses RichFaces 4, then you will need to include the Portlet Bridge RichFaces extension as this is not included with GateIn. It is important that you include the same version of the extension as the one bundled with GateIn.

You can find out what version is included in GateIn by looking in the directory $GATEIN_HOME/modules/org/jboss/portletbridge/api/main.

To do this the following dependency is required in your pom.xml:

<dependency>
    <groupId>org.jboss.portletbridge</groupId>
    <artifactId>portletbridge-extension-richfaces</artifactId>
    <version>INSERT VERSION INCLUDED IN GATEIN</version>
    <scope>runtime</scope>
</dependency>

Disable automatic inclusion of Portlet Bridge

If you still want to include the Portlet Bridge in your application you can disable the automatic inclusion of Portlet Bridge. This could, for example, be useful if you need to use a different version of Portlet Bridge.

To do that, just specify the WAR_BUNDLES_PORTLETBRIDGE context param in your web.xml file like this:

<context-param>
    <param-name>org.gatein.portletbridge.WAR_BUNDLES_PORTLETBRIDGE</param-name>
    <param-value>true</param-value>
</context-param>

The automatic inclusion of Portlet Bridge is also disabled if you are not using the bundled JSF2 implementation (by specifying either WAR_BUNDLES_JSF or JSF_CONFIG_NAME context parameters).

Examples

Portlet Bridge provides the following example JSF2 portlets to assist in including the framework into your own portlets, as well as demonstrating the functionality available. Currently the following examples are available:

  • JSF2 Portlet: basic JSF2 portlet showing f:ajax functionality

  • RichFaces4 Simple: RichFaces 4 form with ajax submission and extended data table showing the submitted data.

  • RichFaces4 Showcase: RichFaces 4 Showcase application, with portlet specific changes

Ideas for future Portlet Bridge examples include a JSF2 portlet that utilizes CDI to inject Beans. If you have other ideas of example portlets, please let us know in the forums.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:27:00 UTC, last content change 2012-10-05 18:19:25 UTC.